package com.ykt.controller;

import java.util.HashMap;
import java.util.Map;

import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Page;
import com.ykt.model.OrderItem;

@ControllerBind(controllerKey="/orderItem")
public class OrderItemController extends BaseController<OrderItem> {

	public OrderItemController() {
		super(OrderItem.class);
	}
	
	public void grid() {
		Integer orderItemId = getParaToInt("orderItemId", -1);
		Map<String, String> paramMap = new HashMap<String, String>();
		paramMap.put("o.id", orderItemId.toString());
		
		int page = getParaToInt("page", 1);
        int rows = this.getParaToInt("rows", 20);
        try {
            Page<OrderItem> date = modelClass.newInstance().pageFindModel(page, rows, paramMap);
            rendDataGrid(date);
        } catch (Exception e) {
            log.error(e);
            rendJson(false, e.getMessage());
        }
	}

}
